package com.tanhua.admin.controller;


import com.tanhua.admin.service.AnalysisService;
import com.tanhua.model.vo.AnalysisSummaryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.Map;

@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private AnalysisService analysisService;

    /**
     * 概要统计信息
     */
    @GetMapping("/summary")
    public AnalysisSummaryVo getSummary() {
        AnalysisSummaryVo analysisSummaryVo = analysisService.getSummary();
        return analysisSummaryVo;
    }
    @GetMapping("/users")
    public Map getTotals(@RequestParam("type") String type,
                                             @RequestParam("sd") Long sd,
                                             @RequestParam("ed") Long ed) throws ParseException {
        Map totals = analysisService.getTotals(type, sd, ed);
//        Map<String, List<Map<String,Object>>>
        return totals;
    }
}